<% layout('/layouts/default.html', {title: '岗位管理', libs: ['validate']}){ %>
<div class="card bd-0">
    <div class="card-header d-flex align-items-start justify-content-between box-header fixed">
        <div class="pt-1">${post.isNewRecord ? '新增岗位' : '编辑岗位'}</div>
        <div class="d-flex">
        </div>
    </div>
    <#form:form id="inputForm" model="${post}" action="${ctx}/sys/post/save" method="post">
        <div class="card-body card-content-fixed pd-sm-t-30 pd-sm-b-40 pd-sm-x-30">
			<div class="form-row">
				<div class="form-group col-md-6">
					<label>岗位编码 <span class="tx-danger ">*</span></label>
					<#form:hidden path="isNewRecord"/>
					<#form:input path="postCode" maxlength="64" readonly="${!post.isNewRecord}" class="form-control required"/>
				</div>
				<div class="form-group col-md-6">
					<label>岗位名称 <span class="tx-danger ">*</span></label>
					<#form:input path="postName" maxlength="100" class="form-control required"/>
				</div>
			</div>
			<div class="form-row">
				<div class="form-group col-md-6">
					<label>岗位分类 <span class="tx-danger ">*</span></label>
					<#form:select path="postType" dictType="sys_post_type" class="form-control select2 required" />
				</div>
				<div class="form-group col-md-6">
					<label>岗位排序 <span class="tx-danger ">*</span></label>
					<#form:input path="postSort" class="form-control required"/>
				</div>
			</div>
			<div class="form-row">
				<div class="form-group col-md-12">
					<label>备注信息 <span class="tx-danger d-none">*</span></label>
				<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control"/>
				</div>
			</div>
        </div>
        <div class="card-footer pd-sm-l-30">
            <div class="row">
                <div class="col-sm-offset-2 col-sm-10">
                	<% if(expIf("hasAuthority('sys:post:edit')")){ %>
                    <button type="submit" class="btn btn-sm btn-primary">保存提交</button>
                    <% } %>
                    <button type="button" class="btn btn-sm btn-default" onclick="js.closeCurrentTabPage()">关闭窗口</button>
                </div>
            </div>
        </div>
   </#form:form>
</div>
<% } %>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});
</script>